function throttle(handle, time) {
	let locked = false;
	return function(...rest) {
		if (locked) return;
		locked = true;
		setTimeout(() => {
			handle.apply(this, rest);
			locked = false;
		}, time);
	}
}

function debounce(handle, time) {
	let locked = null;
	return function(...rest) {
		clearTimeout(locked);
		locked = setTimeout(() => {
			handle.apply(this, rest);
		}, time);
	}
}

function getReqParam(key, reqParam) {
  const reg = new RegExp(`(^|&)${key}=([^&]*)(&|$)`);
  const r =
    reqParam
      .substring(1)
      .match(reg);
  if (r != null) {
    return decodeURIComponent(r[2]);
  }

  return '';
};

export {
	throttle, debounce,
	getReqParam
}